<?php
class page_base {
	private $titre;
	private $style = array (
			'skel-noscript',
			'style',
			'style-desktop' 
	);
	private $corps;
	private $page;
	private $nom;
	private $menu;
	public function __construct($p, $m) {
		$this->page = $p;
		$this->menu = $m;
	}
	
	/**
	 * ****** Gestion des setters ******************
	 */
	public function __set($propriete, $valeur) {
		switch ($propriete) {
			case 'style' :
				{
					$this->style [count ( $this->style ) + 1] = $valeur;
					break;
				}
			
			case 'corps' :
				{
					$this->corps = $valeur;
					break;
				}
			case 'titre' :
				{
					$this->titre = $valeur;
					break;
				}
		}
	}
	
	/**
	 * ****** Gestion du titre ******************
	 */
	private function affiche_titre() {
		echo $this->titre;
	}
	
	/**
	 * ***********Gestion des styles ********************
	 */
	private function affiche_style() {
		/*
		 * foreach ($this->style as $s) {
		 * echo "<link rel='stylesheet' href='styles/".$s.".css' />\n";
		 * }
		 */
		echo '
				<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,700,900" rel="stylesheet" />
				<script src="styles/js/jquery-2.1.1.js"></script>
				<script src="styles/js/appeldynamique.js"></script>
				<script src="styles/js/jquery.waituntilexists.js"></script>
				<script src="styles/js/config.js"></script>
				<script src="styles/js/skel.min.js"></script>
				<script src="styles/js/skel-panels.min.js"></script>
				<script src="styles/js/jquery.dropotron.min.js"></script>
				<script src="styles/js/Interface.js"></script>
				<script src="styles/js/jquery-ui/jquery-ui.min.js"></script>
				<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
				
				';
	}
	/**
	 * ***********Gestion du header**********
	 */
	private function affiche_header() {
		?>
<header>
	<h1>
		<span>Cross USEP <span>2015</span>
		</span>
	</h1>
	<p class="sous-titre">
		<strong>Inscription Session 2015</strong>

	</p>

</header>
<?php
	}
	/**
	 * ***********Gestion du menu************
	 */
	private function affiche_menu() {
		echo $this->menu;
	}
	/**
	 * ***********Affiche corps**************
	 */
	private function affiche_corps() {
		echo $this->corps;
	}
	private function affiche_formcon() {
		if (!isset ( $_SESSION ['pseudo'] ) && !isset($_SESSION ['admin'])) {
			?>
<div class="button button-style1" id="buttonspawnconnect"
	onClick="showconnect(this)">Connexion</div>
<div id="pop-upconnect">
	<input type="text" name="name" placeholder="Identifiant"
		id="identifiant"> <input type="password" name="password"
		placeholder="Mot de passe" id="password">
	<button type="submit" class="button button-style1"
		onClick="connexion()">Connexion</button>
	<button class="button button-style1"
		onClick="submitForm('Inscription')">Inscription</button>
</div>
<?php }else{ ?>
<div class="button button-style1" id="buttonspawnconnect"
	onClick="deconnexion()">Déconnexion</div>
<?php
		
}
	}
	
	/**
	 * ************ Affichage du pied de la page **************************
	 */
	private function affiche_footer() {
		?>
<footer>
	<p>Site de travail Slam4 2014-2015 - servant de base à l'apprentissage
		du PHP</p>
	<p id="copyright">
		Mise en page CA / PFR &copy; 2014 <a
			href="http://chevrollier.e-lyco.fr/">Chevrollier</a>
	</p>
</footer>
<?php
	}
	/**
	 * ************Cours ou TP************
	 */
	/*
	 * public function retourneget($get){
	 * if (isset($_GET[$get])){
	 * $nom = $_GET[$get];
	 * return $nom;
	 *
	 * }
	 * }
	 */
	/**
	 * ****************** Fonction permettant l'affichage de la page *************
	 */
	public function affiche() {
		?>


<!-- DOCCTYPE html -->
<html lang='fr'>

<head>
<title><?php
		
		if ($this->page == 'TP') {
			$this->titre = "Les TP";
		}
		$this->affiche_titre ();
		?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
		$this->affiche_style ();
		?>
</head>

<body class="homepage">
	<div id="chargement"></div>
	<?php $this->affiche_formcon();?>
	<!-- Header Wrapper -->

	<div id="header-wrapper" class="wrapper">
		<div class="container">
			<div class="row">
				<div class="12u">

					<!-- Header -->
					<div id="header">

						<!-- Logo -->
						<div id="logo">
							<?php
		
		$this->affiche_header ();
		?>
						</div>
						<!-- /Logo -->
						<!-- Nav -->
						<?php
		$this->affiche_menu ();
		?>
						<!-- /Nav -->

					</div>
					<!-- /Header -->

				</div>
			</div>
		</div>
	</div>
	<!-- /Header Wrapper -->
	<!-- Main Wrapper -->
	<div class="wrapper wrapper-style2">
	
		<div class="title"></div>
		<div class="container">
			<div class="row">
				<div class="12u">

					<!-- Main -->
					<div id="main">

						<!-- Image 
										<a href="http://fav.me/d5pjw3g" class="image image-featured">
											<img src="images/pic01.jpg" alt="" />
										</a>
									 /Image -->

						<!-- Features -->
						<section id="features">
							<header class="style1"></header>
							<?php
		$this->affiche_corps ();
		
		?>

						</section>
						<!-- /Features -->

					</div>
					<!-- /Main -->

				</div>
			</div>
		</div>
	</div>
	<!-- /Main Wrapper -->
	<?php $this->affiche_footer(); ?>

	</div>
</body>

</html>
<?php
	}
}
?>
